UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PNHk/FMY7bWdEyVWczkoaXxsX7ApDcHmvSVMtkEe2IM=' 
WHERE 
  key_id = 'e95f872cf0afae64402d7cf51eceef53fd47aa11a8136cb876ecefb0f4d477a4' 
  AND (
    token = 'PNHk/FMY7bWdEyVWczkoaXxsX7ApDcHmvSVMtkEe2IM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032