UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'm2cl5GPLxe4AzEiDUn+2IUQ1mv9MUMSUKEWK2sj0vpw=' 
WHERE 
  key_id = 'c2cda2bb0cbfaa81c1542b66155ebdacd895f840b98ac43312678dda6210a512' 
  AND (
    token = 'm2cl5GPLxe4AzEiDUn+2IUQ1mv9MUMSUKEWK2sj0vpw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030