UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fBZjfM5QJr0xQmOSgHqzDqRKef4caMUZUuV+/xb9Xj4=' 
WHERE 
  key_id = 'fdf6165563cfb81e83fcc1a8d1efcb6d95d390b3819d412b7fe416f67401b6d1' 
  AND (
    token = 'fBZjfM5QJr0xQmOSgHqzDqRKef4caMUZUuV+/xb9Xj4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024