UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KefSgu2yohSamuWP1uPEKT+dzv4LNQQMa43XcC2NDLA=' 
WHERE 
  key_id = 'c6df0aa634345dee0034f1260b6f8adbf29a18fe9abaf0357762ce5bd09daa57' 
  AND (
    token = 'KefSgu2yohSamuWP1uPEKT+dzv4LNQQMa43XcC2NDLA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040