UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'r8j0W4U1BrkA5GhfQU1qVpkj7o+tgMu9+mJRI4pOZAs=' 
WHERE 
  key_id = '151d7820fe83777caccac179274e996b0e7fe58f3d6f16fece3ead6fe2ad9878' 
  AND (
    token = 'r8j0W4U1BrkA5GhfQU1qVpkj7o+tgMu9+mJRI4pOZAs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017