UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VnCgNo1R2hRjdUdOedamubbOwn0L8WjdX1agC96kNCw=' 
WHERE 
  key_id = '2975e5fc8978c967ddf4d82d2d65674f704d8460bf1e850b2daa0b53c1659a18' 
  AND (
    token = 'VnCgNo1R2hRjdUdOedamubbOwn0L8WjdX1agC96kNCw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023