UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wWJ1TelKucnEeuJzdoc65ulZzSXlP7GW7Iq2KDFJEG4=' 
WHERE 
  key_id = '83e2c67130ce968e8fea62187f32936933be89f48765f9b0646a82dfd8e264e6' 
  AND (
    token = 'wWJ1TelKucnEeuJzdoc65ulZzSXlP7GW7Iq2KDFJEG4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032