UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1H1x9PozPxvCyrH+BzooayDSE+Xq8hrwQrOddXaJtwI=' 
WHERE 
  key_id = '68d7be2743793272e499843dff6347d36afff778b7408332054d74adb3a98576' 
  AND (
    token = '1H1x9PozPxvCyrH+BzooayDSE+Xq8hrwQrOddXaJtwI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052