UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eFlr8xRu7xNKmvr9/wMop+mjh/xiprGBxHvUo0pgD1Y=' 
WHERE 
  key_id = 'da00e90402e3099eb35413b1881b33aefffb851ee90ce91b8d6c3e9cda8e4edb' 
  AND (
    token = 'eFlr8xRu7xNKmvr9/wMop+mjh/xiprGBxHvUo0pgD1Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040