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

Query time 0.00031