UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lC+ZhejwgQWtPmHgaE9juR6MtkoASR9Nx7KwvKOKVV8=' 
WHERE 
  key_id = '0f64beaa65ae55db92f1ae866d02e5396a2fc1e196e3c9b24a233a1af0bcd686' 
  AND (
    token = 'lC+ZhejwgQWtPmHgaE9juR6MtkoASR9Nx7KwvKOKVV8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032