UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xnPkaPsE78/8mij8YJtKA4QegODEoALB326HZCaVS1Q=' 
WHERE 
  key_id = '5a81089e9a16a2f1e2a6fae4072d689cefd8cd9773ca4ce3ed35013035c00def' 
  AND (
    token = 'xnPkaPsE78/8mij8YJtKA4QegODEoALB326HZCaVS1Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028