UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mgdUSpXjyg63fmMbTq1z9pgO+RQm8QQTjHuK3RTunMM=' 
WHERE 
  key_id = 'c855cad891388df69294fc24353743d176921f92b175c94bd5fcb73bc5d7aa81' 
  AND (
    token = 'mgdUSpXjyg63fmMbTq1z9pgO+RQm8QQTjHuK3RTunMM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040