UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YJYA+vVhCHr4SDn05jnSdOIBSnPfbAaWXduTtbI7+ZY=' 
WHERE 
  key_id = '4ba624d828fc0840b848c279695fcee4cbf2562c748a62fcde9505ef0dd6b92a' 
  AND (
    token = 'YJYA+vVhCHr4SDn05jnSdOIBSnPfbAaWXduTtbI7+ZY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047