UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bEqZsIMsHI7ykU7+myWL/e7jJsceulJE9wZcnOFpQ0w=' 
WHERE 
  key_id = '4ecadf6d72eb24d9114b65d09eba7431dd1f95272036d7b8156fbcaf14b89394' 
  AND (
    token = 'bEqZsIMsHI7ykU7+myWL/e7jJsceulJE9wZcnOFpQ0w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039