UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RZ3iGaoUUF23UyXn+eHQSFXxy0UTM+0JxHquVhiC9Uk=' 
WHERE 
  key_id = '3aa38f554a3947160427a430c013ef4b64f84a6af3735b4004b721aadb24b5be' 
  AND (
    token = 'RZ3iGaoUUF23UyXn+eHQSFXxy0UTM+0JxHquVhiC9Uk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018