UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZxhD6veTubDCLKIvVUW1gYMviHOJ2Gt5uMcfWSHit+k=' 
WHERE 
  key_id = '1e74618912f300ed09ae39d92329c60077d00233d7d9963d7d77b9485ea1181e' 
  AND (
    token = 'ZxhD6veTubDCLKIvVUW1gYMviHOJ2Gt5uMcfWSHit+k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037