UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rFs6sArNy5Xzvq9+9+5N3DAAFzLhnG0pmy1zPb5phPk=' 
WHERE 
  key_id = '0bc487fe74295bdfcc9b2a9244891f1bf5b674e22bdfb8d962cb6944daa6f9c5' 
  AND (
    token = 'rFs6sArNy5Xzvq9+9+5N3DAAFzLhnG0pmy1zPb5phPk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035