UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Xq3LgMB0S6TJVnfmhI/QgxhjlTZtgsdXHT8/FYl9YFg=' 
WHERE 
  key_id = 'c582abb5d1c7612e71cc6b8219aa0f0823670294519bacf02145cc54e42f98b0' 
  AND (
    token = 'Xq3LgMB0S6TJVnfmhI/QgxhjlTZtgsdXHT8/FYl9YFg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00142