UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yuPu8KcT5o0idCfebHB4K82t20GmraIlog+X1/oZQR4=' 
WHERE 
  key_id = '4afe189e3b94fd8b10892dd423d3f3577e938952983d24f0e428a6cfce08321f' 
  AND (
    token = 'yuPu8KcT5o0idCfebHB4K82t20GmraIlog+X1/oZQR4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00014