UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hX9r7jO3572b803AZHD7Sp+AvLU4HtTRkK7VlL9aQoc=' 
WHERE 
  key_id = 'a8cc5ea8a7fd18a3c16a4c062a43d4edf7968eead6d55eb9d05a6ddf4b82d0f8' 
  AND (
    token = 'hX9r7jO3572b803AZHD7Sp+AvLU4HtTRkK7VlL9aQoc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00093