UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Bz4Z6WSrJTId8UlkgF/DV59aAjarFFyRoSE5peAXLbg=' 
WHERE 
  key_id = '5ff9b3496b545249405f9567022705be733634c80912f7889219fa610e29a67d' 
  AND (
    token = 'Bz4Z6WSrJTId8UlkgF/DV59aAjarFFyRoSE5peAXLbg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031