UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'C97oU8XR+evEddsUxDb5d1CyiF86Fg1mUQflofjBwDQ=' 
WHERE 
  key_id = '76571fb234ef192e05258c6e7349203084a394354899f3b3ca409ba20ba0a7b6' 
  AND (
    token = 'C97oU8XR+evEddsUxDb5d1CyiF86Fg1mUQflofjBwDQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042