UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dB/s7xZAG/amh6/0Sk8q01To7KPeW96+qoFXjOYVPe4=' 
WHERE 
  key_id = 'adbe809ac995a25cec784b7812ad33251cdb90ffabbc0239f0840117fbb16b28' 
  AND (
    token = 'dB/s7xZAG/amh6/0Sk8q01To7KPeW96+qoFXjOYVPe4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024