UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8yypOPa3fqXF/ivKT88yRIF60gvJAErM2ku75LgNYWI=' 
WHERE 
  key_id = 'ae501effd86080078e854ee999142a2fff827cd34683ce15d5e94e883e25709c' 
  AND (
    token = '8yypOPa3fqXF/ivKT88yRIF60gvJAErM2ku75LgNYWI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045