UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XSORtdbUq7tgB+HReMwuQvvnIlnLVIjUQNflR2JiUM0=' 
WHERE 
  key_id = 'a39ae0edc36b38df64d7bc10dbe95444ecaccc09cec9fd1b1061ebe5f2510fbf' 
  AND (
    token = 'XSORtdbUq7tgB+HReMwuQvvnIlnLVIjUQNflR2JiUM0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017