UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9m+s9pFXzL2/9VlaBgeh5nIK2yw4vHziqZwER2KNrx8=' 
WHERE 
  key_id = 'a6050e3647c1d188cfa5510ae390e7a01f1293651a6194145ce8699706504778' 
  AND (
    token = '9m+s9pFXzL2/9VlaBgeh5nIK2yw4vHziqZwER2KNrx8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027