UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SSnAGCuzhC7I1fEl6UU0l+Qx12cn8LW5R5lnKbi+VP8=' 
WHERE 
  key_id = '05ab8a6374a55893993d5217a304ea471b5ca1fddff1c2b47ef361d87a552d40' 
  AND (
    token = 'SSnAGCuzhC7I1fEl6UU0l+Qx12cn8LW5R5lnKbi+VP8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033