UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P0S8rx5QhdOGZOMTL7I2FSjl19W4mhIixdMRFDUe/4o=' 
WHERE 
  key_id = '5bbc9f941aabe357888ca9f74473645db04315befc397ff444ed3acc2b389e36' 
  AND (
    token = 'P0S8rx5QhdOGZOMTL7I2FSjl19W4mhIixdMRFDUe/4o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036