UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ayy0Fwbdvqb2MF88XY5+0017MuUg1Y0hpa2yoQXb77E=' 
WHERE 
  key_id = 'faed56c2cefd3696ddbaa2bf328a8551bcdba697a2b9ce364c85fb3c5db9fde0' 
  AND (
    token = 'Ayy0Fwbdvqb2MF88XY5+0017MuUg1Y0hpa2yoQXb77E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029