UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5ZTQ4vcEnO4yxCzbDR/Oa5/bSgjoy8FO1ML8q9ghCdE=' 
WHERE 
  key_id = 'b6c402b2ec3eb36c5dff80317f7735e7df2f4c136b30961f07f1add344112398' 
  AND (
    token = '5ZTQ4vcEnO4yxCzbDR/Oa5/bSgjoy8FO1ML8q9ghCdE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052