UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'I1iB9ezTLffYOh32fzLbP5U84pDYwNuI4SeDhl1o2Uc=' 
WHERE 
  key_id = '86c7f17743864ca76cd8cd944fba6a4ef30be71f02181c40c48db66d4c488df9' 
  AND (
    token = 'I1iB9ezTLffYOh32fzLbP5U84pDYwNuI4SeDhl1o2Uc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028