UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'X2jmdwGVvVDsY15YRUGtBzfefohHGdZj2fwW/bRFSrk=' 
WHERE 
  key_id = '7c052c4dcbeaf47a781773f08bd3be2a61a4121b148758ca8033e22d14df6306' 
  AND (
    token = 'X2jmdwGVvVDsY15YRUGtBzfefohHGdZj2fwW/bRFSrk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052