UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '46+NYc4p8WeMfcg7WKJEFXUyuA5Nf1eb6q2PRWzfg5Q=' 
WHERE 
  key_id = 'e4ba1c3ff0dbdc746cf54554b0823ecdf59c43c82cbfd0dd510a2790748cc4ac' 
  AND (
    token = '46+NYc4p8WeMfcg7WKJEFXUyuA5Nf1eb6q2PRWzfg5Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030