UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TzAzIinmlzR0xQU8pkSUeUHCjAP+8qulqow+pmzzDkg=' 
WHERE 
  key_id = '94402485fd4d9ba9fb5536fd7b030e64a5a67d8bf5dfe1de74a0cd2776b6c3d5' 
  AND (
    token = 'TzAzIinmlzR0xQU8pkSUeUHCjAP+8qulqow+pmzzDkg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037