UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zUEqT9LJ6+N2DmNwgUd0m5FwohtoqyscZA3moLWKA+k=' 
WHERE 
  key_id = '87294c00689d33a093c5d37c154c4a200d302911fe2976d40ce577f7f9cf1208' 
  AND (
    token = 'zUEqT9LJ6+N2DmNwgUd0m5FwohtoqyscZA3moLWKA+k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050