UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Bo4oXgZaPjfvGdKtDWyyC65QYrYQ0aXX8dBTj96PR7U=' 
WHERE 
  key_id = 'bfe3452832dc0828887a572e170ad3b9259402c9359fdc4592482da6453e248c' 
  AND (
    token = 'Bo4oXgZaPjfvGdKtDWyyC65QYrYQ0aXX8dBTj96PR7U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026