UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6ZyaWxwTZMDzfzrdfv77eG4CNGcftzDEUcl3KS2hxnY=' 
WHERE 
  key_id = 'af86d976a2798520a1feeaf0ee165734b626d448849d2861229b2ab059c2768c' 
  AND (
    token = '6ZyaWxwTZMDzfzrdfv77eG4CNGcftzDEUcl3KS2hxnY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019