UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nlEB+Zk2bKglSxE+SVChNJiJt6m+okqTCAsGLa4KD0Q=' 
WHERE 
  key_id = '4b3992bc63a79ec0a1b70c0f08b88136b3caa26b9e6b9f50cbdc2876af511c47' 
  AND (
    token = 'nlEB+Zk2bKglSxE+SVChNJiJt6m+okqTCAsGLa4KD0Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024