UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QFv6go/grw+J8+LbF/g5FszNxF8zZ4XnM3W6OlD+zHs=' 
WHERE 
  key_id = '591a2a35a669622ccd51240aceea18cc769a29528f81af0241e24ea4da7fdd7f' 
  AND (
    token = 'QFv6go/grw+J8+LbF/g5FszNxF8zZ4XnM3W6OlD+zHs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048