UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'toCw0Cwqcr8EAELazIB4gjNhAoww/lZmVSoGxl0cF80=' 
WHERE 
  key_id = '7778e2b6b72af3aea3b4ef8e1e1b09a4f7a3a5c9be64f9eff5746dad487a711c' 
  AND (
    token = 'toCw0Cwqcr8EAELazIB4gjNhAoww/lZmVSoGxl0cF80=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040